const mongoose = require('mongoose')

const cartSchema = new mongoose.Schema({
    username: {type: String,required: true},

    goodsId: {type: String,required: true},
    goodsName: {type: String,required: true},
    goodsImg: {type: String,required: true},
    goodsPrice: {type: Number,required: true},
    goodsSkus: {type: Array,required: true},
    goodsNum: {type: Number,default: 10}, // 不要尝试去把它理解成库存
    goodsTitle: String,
    goodsDesc: String,

    buySku: {type: String,default: ''},
    buyNum: {type: Number,default: 0},
})

const Cart = mongoose.model('cart',cartSchema)

module.exports = Cart